{% extends "base_generic.html" %}
{% block script %}
  <style type="text/css">
    .swfupload {
      position: absolute;
      z-index: 1;
    }
  </style>
<script type="text/javascript" src="/js/jsr_class.js"></script>
<script type="text/javascript">
  var fromOrig = "{{user.fromname|default_if_none:""}}";
  var livingOrig = "{{user.livingname|default_if_none:""}}";
  var nick = "{{user.username}}";
</script>
  <script type="text/javascript">
    var swfu;
    window.onload = function () {
      swfu = new SWFUpload({
        flash_url : "/js/swfupload.swf",
        upload_url: "/upload/avatar",
        post_params: {"PHPSESSID": "{{user.key}}"},

        file_size_limit : "4 MB",
        file_types : "*.jpg;*.JPG;*.gif;*.GIF;*.jpeg;*.JPEG;*.png;*.PNG",
        file_types_description : "Images",
        file_upload_limit : 0,
        debug: false,

        // Button settings
        button_placeholder_id: "btnBrowse_placeholder",
        button_width: 100,
        button_height: 20,
        button_window_mode: SWFUpload.WINDOW_MODE.TRANSPARENT,
        button_cursor: SWFUpload.CURSOR.HAND,
        button_action: SWFUpload.BUTTON_ACTION.SELECT_FILE,

        file_queue_error_handler : fileQueueError,
        file_dialog_complete_handler : fileDialogComplete,
        upload_start_handler : uploadStart,
        upload_progress_handler : uploadProgress,
        upload_error_handler : uploadError,
        upload_success_handler : uploadSuccess,
        upload_complete_handler : uploadComplete,

        // SWFObject settings
        minimum_flash_version : "9.0.28",
        swfupload_pre_load_handler : swfUploadPreLoad,
        swfupload_loaded_handler : swfUploadLoaded,
        swfupload_load_failed_handler : swfUploadLoadFailed
      });
    }
  </script>
{% endblock %}
{% block body %}
<body id="baacount">
{% endblock %}
{% block content %}
<div id="maincontent"> 
    <h1>Edit your profile</h1> 
    <form action="/account/profile" method="post" id="editprofile" name="editprofile"> 
      <div class="line"> 
        <label for="firstname">First name:</label> 
        <input type="text" class="text" id="firstname" name="firstname" maxlength="30" value="{{user.firstname}}" /> 
      </div> 
      <div class="line"> 
        <label for="lastname">Last name:</label> 
        <input type="text" class="text" id="lastname" name="lastname" maxlength="30" value="{{user.lastname}}" /> 
      </div> 
      <div class="line severalradios"> 
        <label>Gender:</label> 
        <input type="radio" class="radio" name="gender"{% ifequal user.gender 'male' %} checked="checked" {% endifequal %} value="male" id="male" /><label class="lblradio male" for="male">Male</label> 
        <input type="radio" class="radio" name="gender" value="female"{% ifequal user.gender 'female' %} checked="checked" {% endifequal %} id="female" /><label class="lblradio female" for="female">Female</label> 
        <input type="radio" class="radio" name="gender" value="other" {% ifequal user.gender 'other' %} checked="checked" {% endifequal %} id="other" /><label class="lblradio other" for="other">Other</label> 
      </div> 
      <div class="line"> 
        <label for="day">Birthdate:</label>
        <select id="day" name="day">
          <option></option>
          {% for day in days %}
          <option value="{{day|add_zeros}}"{% ifequal day selectedday %} selected="selected" {% endifequal %}>{{day|add_zeros}}</option>
          {% endfor %}
        </select> 
        <select id="month" name="month"> 
          <option></option> 
          <option value="01"{% ifequal selectedmonth 1 %} selected="selected" {% endifequal %}>January</option> 
          <option value="02"{% ifequal selectedmonth 2 %} selected="selected" {% endifequal %}>February</option>     
          <option value="03"{% ifequal selectedmonth 3 %} selected="selected" {% endifequal %}>March</option>
          <option value="04"{% ifequal selectedmonth 4 %} selected="selected" {% endifequal %}>April</option>
          <option value="05"{% ifequal selectedmonth 5 %} selected="selected" {% endifequal %}>May</option>
          <option value="06"{% ifequal selectedmonth 6 %} selected="selected" {% endifequal %}>June</option>
          <option value="07"{% ifequal selectedmonth 7 %} selected="selected" {% endifequal %}>July</option>
          <option value="08"{% ifequal selectedmonth 8 %} selected="selected" {% endifequal %}>August</option>
          <option value="09"{% ifequal selectedmonth 9 %} selected="selected" {% endifequal %}>September</option>
          <option value="10"{% ifequal selectedmonth 10 %} selected="selected" {% endifequal %}>October</option>
          <option value="11"{% ifequal selectedmonth 11 %} selected="selected" {% endifequal %}>November</option>
          <option value="12"{% ifequal selectedmonth 12 %} selected="selected" {% endifequal %}>December</option>
        </selected>
        <select id="year" name="year"> 
          <option></option>
          {% for year in years %}
          <option value="{{year}}"{% ifequal year selectedyear %} selected="selected" {% endifequal %}>{{year}}</option>
          {% endfor %}
        </select>
      </div> 
      <div class="line"> 
        <label for="from">From:</label> 
        <input type="text" class="text" id="from" name="from" name="from" value="{{user.fromplacename}}" /> 
        <input type="hidden" id="hidfromid" name="hidfromid" value="{{user.fromplaceid}}" /> 
        <input type="hidden" id="hidfromc" name="hidfromc" value="0" /> 
      </div> 
      <div class="line"> 
        <label for="living">Now living in:</label> 
        <input type="text" class="text" id="living" name="living" value="{{user.livingplacename}}" /> 
        <input type="hidden" id="hidlivingid" name="hidlivingid" value="{{user.livingplaceid}}" /> 
        <input type="hidden" id="hidlivingc" name="hidlivingc" value="0" /> 
        <input type="hidden" id="hidlivingdb" name="hidlivingdb" value="{{user.livingplaceid}}" /> 
      </div> 
      <div class="line"> 
        <label for="relation">Relationship Status:</label> 
        <select id="relation" name="relation"> 
          <option></option> 
          <option value="single"{% ifequal user.relation 'single' %} selected="selected"{% endifequal %}>Single</option> 
          <option value="taken"{% ifequal user.relation 'taken' %} selected="selected"{% endifequal %}>Taken</option> 
          <option value="open"{% ifequal user.relation 'open' %} selected="selected"{% endifequal %}>Open</option>
          <option value="na"{% ifequal user.relation 'na' %} selected="selected"{% endifequal %}>It's complicated</option>
        </select> 
      </div> 
      <div class="line"> 
        <label for="about">About you:</label> 
        <textarea cols="10" rows="5" id="about" name="about">{{user.about}}</textarea> 
      </div> 
      <h2 id="avatar">Profile image</h2> 
      <img id="avatarg" src="/img/175x175/missha.jpg?92" alt="" height="175" width="175" /> <img id="avatarp" src="/img/45x45/missha.jpg?92" alt="" height="45" width="45" />      <p id="upError" style="display: none;"></p> 
      <div id="prevdelete" style="display: block;"><a href="#" onclick="deleteAvatar('2'); return false;">Delete</a></div> 
      <div id="avatarprogressBar"><div id="bar"></div></div> 
      <div class="line avatar"> 
        <label for="image">Image:</label> 
        <span id="btnBrowse_placeholder"></span> 
        <input type="button" value="Select image" id="btnBrowse" disabled="disabled" />  
        <p class="note">It will be reduced to 175 x 175 px</p> 
      </div> 
      
      
      <div id="alt" style="display: none;"></div> 
      
      <h2>5 things (or more) people should know about you:</h2> 
      <div id="things">
              {% for thing in things %} 
        <div class="line" id="things_{{forloop.counter0}}"> 
          <label for="thing{{forloop.counter0}}">#{{forloop.counter}}:</label>
          <input type="text" class="text" id="thing{{forloop.counter0}}" name="thing{{forloop.counter0}}" value="{{thing}}" /> 
        </div>
        {% endfor %}
        <input type="hidden" name="thingscounter" id="thingscounter" value="{{things|length}}" />      
        <p class="more"><a href="#">Add another thing</a></p> 
      </div> 
      <h2>Websites:</h2>    
    
      <div id="webs">
              {% for url in urls %}
        <div class="line" id="urls_{{forloop.counter0}}"> 
          <label for="url{{forloop.counter}}">Website <span>{{forloop.counter}}</span>:</label> 
          <input type="text" class="text" id="url{{forloop.counter0}}" name="url{{forloop.counter0}}" value="{{url}}" /> 
        </div>              
              {% endfor %}
              <input type="hidden" name="urlscounter" id="urlscounter" value="{{urls|length}}" />            
        <p class="more"><a href="#">Add another website</a></p> 
      </div> 
      <input type="submit" value="Save changes" name="save" class="button" name="submit" /> 
    </form> 
  </div> 
  <div id="sidebar"> 
    <div id="content-actions"> 
      <ul> 
        <li id="myprofile"><a href="/missha/profile">See your profile</a></li> 
        <li id="changeaccount"><a href="/account">Edit your account</a></li> 
      </ul> 
          </div> 
  </div> 
  <br class="clear" />
{% endblock %}
